import pyttsx3

def speak(text):
    engine = pyttsx3.init()
    engine.setProperty('rate', 270)  # 语速，可调
    engine.setProperty('volume', 5)  # 音量
    engine.setProperty('voice', 'zh-CN-XiaoxiaoNeural')  # 设置特定语音
    engine.say(text)
    engine.runAndWait()

if __name__ == "__main__":
    speak("你好，这是一条测试语音。")
